home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / cmd67b.zip / ARGS.CPP < prev    next >
C/C++ Source or Header  |  1995-07-27  |  4KB  |  91 lines

  1. /******************************************************************\
  2. *                                                                  *
  3. *          w       w                oooo                           *
  4. *          w       w  iii  n   n   o    o   n   n  eeee            *
  5. *          w       w   i   nn  n  o      o  nn  n  e               *
  6. *          w   w   w   i   n n n  o      o  n n n  eee             *
  7. *           w w w w    i   n  nn   o    o   n  nn  e               *
  8. *            w   w    iii  n   n    oooo    n   n  eeee            *
  9. *                                                                  *
  10. *     C o m m a n d   L a n g u a g e   I n t e r p r e t e r      *
  11. *                                                                  *
  12. *                                                                  *
  13. *   External Command ARGS                                          *
  14. *   Written by Lucien Cinc                                         *
  15. *   Copyright (c) 1993                                             *
  16. *                                                                  *
  17. \******************************************************************/
  18.  
  19. #include "args.h"
  20.  
  21. //    table colours
  22.  
  23. #define COLTAB    DARKGRAY    // colour of table
  24. #define COLHEAD    COL_HIGHTEXT        // colour of headings
  25. #define COLFN    COL_TEXT    // colour of function names
  26. #define COLVAR    COLFN        // colour of global variables
  27. #define COLARG    COL_HIGHTEXT        // colour of command line args
  28. #define COLNUM    COL_NUMBER        // colour of numbers
  29.  
  30. int main(void)
  31. {
  32.     char *sp;
  33.     int i, n;
  34.  
  35.     screen(BUFFERED);
  36.  
  37.     // command line argument functions
  38.  
  39.     textcolor(COLTAB);
  40.     printf("                  %cCommand line argument functions%c\n", COLHEAD, COLTAB);
  41.     printf(" ---+---------------------------------------------------------------\n");
  42.     printf("  %cn %c|                         %cargv(n)%c\n",
  43.                 COLFN, COLTAB, COLFN, COLTAB);
  44.     printf(" ---+---------------------------------------------------------------\n");
  45.     n = argc();
  46.     for (i = 0;i <= n;i++) {
  47.  
  48.         printf(" %c%2d %c| %c%-s%c\n",
  49.                 COLNUM, i, COLTAB, COLARG, argv(i), COLTAB);
  50.  
  51.     }
  52.     printf(" ---+---------------------------------------------------------------\n");
  53.     printf("  %cargc()    %c= %c%2d%c\n", COLFN, COLTAB, COLNUM, n, COLTAB);
  54.     printf("  %cargn()    %c= %c%2d%c, %cargs() %c= %c%s%c\n",
  55.                 COLFN, COLTAB, COLNUM, argn(), COLTAB, COLFN, COLTAB, COLARG, args(), COLTAB);
  56.     printf("  %cargtail() %c= %c%s%c\n", COLFN, COLTAB, COLARG, argtail(), COLTAB);
  57.  
  58.     // command line argument path functions
  59.  
  60.     printf(" ---+-------------------------------+-------------------------------\n");
  61.     printf("  %cn %c|          %cargpath(n)           %c|            %cargabs(n)          %c\n",
  62.                 COLFN, COLTAB, COLFN, COLTAB, COLFN, COLTAB);
  63.     printf(" ---+-------------------------------+-------------------------------\n");
  64.     for (i = 0;i <= n;i++)
  65.         printf(" %c%2d %c| %c%-29s %c| %c%-29s%c\n",
  66.                     COLNUM, i, COLTAB, COL_FILENAME, argpath(i), COLTAB, COL_FILENAME, argabs(i), COLTAB);
  67.     printf(" ---+-------------------------------+-------------------------------\n\n\n\n");
  68.  
  69.     // Command line argument global variables
  70.  
  71.     printf("              %cCommand line argument global variables%c\n", COLHEAD, COLTAB);
  72.     printf(" ---+---------------------------------------------------------------\n");
  73.     printf("  %cn %c|                         %carg_v[n]%c\n",
  74.                 COLVAR, COLTAB, COLVAR, COLTAB);
  75.     printf(" ---+---------------------------------------------------------------\n");
  76.     for (i = 0;i <= arg_c;i++)
  77.         printf(" %c%2d %c| %c%s%c\n", COLNUM, i, COLTAB, COLARG, arg_v[i], COLTAB);
  78.     printf(" ---+---------------------------------------------------------------\n");
  79.     printf("  %carg_c %c= %c%d%c\n", COLVAR, COLTAB, COLNUM, arg_c, COLTAB);
  80.     printf(" -------------------------------------------------------------------\n");
  81.  
  82.     screen(UNBUFFERED);
  83.  
  84.     return 0;     // all ok
  85. }
  86.  
  87.  
  88.  
  89.  
  90.  
  91.